import axiosReq from '@/utils/axios-req'

/**
 * refreshTokenCheck验证
 * @param data
 * @returns
 */
export const userRefreshTokenCheck = async () => {
  const { userInfo } = useBasicStore()
  const data: any = await axiosReq({
    baseURL: 'authority',
    __isRefreshToken: true,
    url: '/api/v1/user/refreshTokenCheck',
    data: {
      userId: userInfo.userId
    },
    method: 'post',
    showElMsg: false
  })
  window.name = JSON.stringify({
    appId: userInfo.appId,
    userId: userInfo.userId,
    userName: userInfo.username,
    refreshToken: data.refreshToken,
    token: data.token
  })
  return data
}
